<?php
abstract class K_MVC_Controller_EntryPointAbstract extends K_MVC_Controller_Abstract {

    protected function _redirect ($location) {
        if (substr($location, 0, 1) != '/') {
            $location = '/'.$location;
        }

        // Сохраним сессию перед переходом
        $_SESSION = $this->_SESSION()->getAsArray();

        $strDomain = $this->_getConfig('BASE_URL');
        $strProtocol = $this->_getConfig('PROTOCOL');
        header('Location:'.$strProtocol.$strDomain.$location);
        exit;
    }

    /**
    * @return mixed
    */
    protected function _SERVER_Item ($strOptionName) {
        return $this->_getContainer()
        ->get('SERVER')
        ->get($strOptionName);
    }


    /**
     * @return K_getContainer()_OnlyRead
     */
    protected function _SERVER () {
        return $this->_getContainer()->get('SERVER');
    }


    /**
     * @return mixed
     */
    protected function _POST_Item ($strName) {
        return $this->_getContainer()
        ->get('POST')
        ->get($strName);
    }


    /**
     * @return K_getContainer()_OnlyRead
     */
    protected function _POST () {
        return $this->_getContainer()->get('POST');
    }


    /**
     * @return mixed
     */
    protected function _GET_Item ($strName) {
        if ($this->_getContainer()->get('GET')->isExists($strName)) {
            return $this->_getContainer()
            ->get('GET')
            ->get($strName);
        }

        return false;
    }


    /**
     * @return K_getContainer()_OnlyRead
     */
    protected function _GET () {
        return $this->_getContainer()->get('GET');
    }


    /**
     * @return Container_Interface
     */
    protected function _SESSION () {
        return $this->_getContainer()->get('SESSION');
    }


    protected function _SESSION_Item($strName) {
        if ($this->_getContainer()->get('SESSION')->isExists($strName)) {
            return $this->_getContainer()
            ->get('SESSION')
            ->get($strName);
        }

        return false;
    }

}